<template>
  <a-tree
    v-model="checkedKeys"
    :defaultExpandAll="true"
    checkable
    :tree-data="treeData"
  />
</template>
<script>
const treeData = [
  {
    key: 'profile',
    title: '商户中心',
  },
  {
    key: 'orders',
    title: '订单管理',
    children: [
      {
        key: 'buy',
        title: '买入订单',
      },
      {
        key: 'sell',
        title: '卖出订单',
      },
    ],
  },
  {
    key: 'balance',
    title: '财务管理',
    children: [
      {
        key: 'details',
        title: '账变明细',
      },
      {
        key: 'report',
        title: '数据报表',
      },
    ],
  },
  {
    key: 'manual',
    title: '人工出币',
    children: [
      {
        key: 'out',
        title: '手动出币',
      },
      // {
      //   key: 'agencys',
      //   title: 'SDK接口出单',
      // },
    ],
  },
  {
    key: 'coins',
    title: '买币',
  },
  {
    key: 'config',
    title: '设置',
    children: [
      {
        key: 'password',
        title: '登录密码',
      },
      {
        key: 'security',
        title: '安全密码',
      },
      {
        key: 'whitelist',
        title: '白名单',
      },
      {
        key: 'ga',
        title: '谷歌验证',
      },
    ],
  },
]

export default {
  data() {
    return {
      checkedKeys: [],
      treeData,
    }
  },
  // watch: {
  //   checkedKeys(val) {
  //     console.log('onCheck', val)
  //   },
  // },
  methods: {
    // onExpand(expandedKeys) {
    //   console.log('onExpand', expandedKeys)
    //   // if not set autoExpandParent to false, if children expanded, parent can not collapse.
    //   // or, you can remove all expanded children keys.
    //   this.expandedKeys = expandedKeys
    //   this.autoExpandParent = false
    // },
    onCheck(checkedKeys) {
      console.log('onCheck', checkedKeys)
      this.checkedKeys = checkedKeys
    },
    onSelect(selectedKeys, info) {
      console.log('onSelect', info)
      this.selectedKeys = selectedKeys
    },
  },
}
</script>
